<?php
  if (!defined('EXPONENT')) exit('');
    if (exponent_users_isAdmin() ||  exponent_permissions_check(array("administrate"),$loc))
    {
        if (isset($_REQUEST['id']))
        {
            if(isset($_REQUEST['mail_status']))
        {
            if($_REQUEST['mail_status']==0)
            {
                $table='mailsystem_mail';
            }
            else if($_REQUEST['mail_status']==1)
            {
                $table='mailsystem_mail_sent';
            }
            else
            {
                $table='mailsystem_mail_error';
            }
            
        }
            $id=intval($_REQUEST['id']);
            $db->delete($table, 'id = '.$id);
        }
        echo "OK";
    }
    else
        exponent_http_error(403);
?>
